package com.mall.autoconfig.interceptor;

/**
 *
 * @Date 2023-02-09 14:27
 * @Desc 线程存入用户Id
 */
public class BaseContext {
    /**
     * 获取线程
     */
    private static ThreadLocal<String> threadLocal = new ThreadLocal<>();

    /**
     * 设置用户Id
     *
     * @Date: 2023-02-09 14:29
     * @Greet2u:  （O｀ 3′O）~~♡
     * @param id
     * @return void
     */
    public static void setCurrentId(String id){
        threadLocal.set(id);
    }

    /**
     * 获取用户Id
     *
     * @Date: 2023-02-09 14:29
     * @Greet2u:  （O｀ 3′O）~~♡
     * @return java.lang.Long
     */
    public static String getCurrentId(){
        return threadLocal.get();
    }

    /**
     * 删除
     *
     * @param
     * @return void
     *
     */
    public static void remove() {
        threadLocal.remove();
    }
}
